package com.hdu.dwh.controller;

import com.hdu.dwh.service.AssetService;
import com.hdu.dwh.service.IDatabaseAllService;
import com.hdu.dwh.results.ResponseResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/asset")
@RequiredArgsConstructor
@Tag(name = "资产管理")
public class AssetController {

    private final AssetService assetService;
    private final IDatabaseAllService databaseAllService;

    @Operation(summary ="资产概览")
    @GetMapping("/overview")
    public ResponseResult<?> overview(){
        return assetService.overview();
    }

    @Operation(summary ="查资产目录树")
    @GetMapping("/tree")
    public ResponseResult<?> tree(){
        return assetService.tree();
    }

    @Operation(summary ="查所有数据库")
    @GetMapping("/database")
    public ResponseResult<?> database(@RequestParam(required = false) Integer dataBaseType){
        return databaseAllService.listByDatabaseType(dataBaseType);
    }
}
